<template>
  <footer class="footer">
    <span class="todo-count"
      >剩余<strong>{{ list.length }}</strong></span
    >
    <ul class="filters">
      <li>
        <a @click="changeFn('all')"  :class="{selected:flag==='all'}" href="javascript:;">全部</a>
      </li>
      <li>
        <a  @click="changeFn('nook')" :class="{selected:flag==='nook'}" href="javascript:;">未完成</a>
      </li>
      <li>
        <a  @click="changeFn('ok')" :class="{selected:flag==='ok'}" href="javascript:;">已完成</a>
      </li>
    </ul>
    <button @click="delok" class="clear-completed">清除已完成</button>
  </footer>
</template>

<script>
export default {
  props: {
    list: {
      type: Array,
      default: () => [],
    },
    flag: {
      type: String,
      default: "",
    },
  },
  methods: {
    changeFn(infod) {
      this.$emit('condition',infod)
    },
    delok(){
      this.$emit('clearCompleted')
    }
  },
};
</script>